package com._2_1;

public class BasicForceChange {
	//基本的强制类型转换
	public static void main(String[] args) {
		double db = 143.426d;
		float f = (float) db;	//将double强制转换成float
		long l = (long) db;		//将double强制转换成long
		int i = (int) db;		//将double强制转换成int
		short s = (short) db;	//将double强制转换成short
		byte b = (byte) db;	    //将double强制转换成byte
		System.out.print("d = " + db + "; f = " + f + "; l = " + l);
		System.out.println("; i = " + i + "; s = " + s + "; b = " + b);
		//下面的转换进行截断操作
		db = 5127.87d;
		b = (byte) db;
		System.out.println("d = " + db + "; b = " +b);
	}
}
